package com.ywger.integration.log;

import static com.ywger.integration.constants.log.LogFormat.TASK_BIZ_FORMAT;
import static com.ywger.integration.constants.log.LogFormat.TASK_END_FORMAT;
import static com.ywger.integration.constants.log.LogFormat.TASK_START_FORMAT;
import org.slf4j.Logger;

/**
 * @author chenmeng
 * @date 2021-07-24 19:06
 * @desc
 */
public class TaskLogger extends CommonLogger{

    public static void  start(Logger log, String taskName) {
        log.info(TASK_START_FORMAT, taskName);
    }

    public static void end(Logger log, String taskName) {
        log.info(TASK_END_FORMAT, taskName);
    }

    public static void info(Logger log, String taskName, String customFormatMsg, Object... arguments){
        String format = String.format(TASK_BIZ_FORMAT,customFormatMsg);
        log.info(format,expand(taskName,arguments));
    }

    public static void warn(Logger log, String taskName, String customFormatMsg, Object... arguments){
        String format = String.format(TASK_BIZ_FORMAT,customFormatMsg);
        log.warn(format,expand(taskName,arguments));
    }
}
